# 设置包含头文件
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(/usr/include/libxml2)

# comm
set(COMM_SRC 
    comm/Agent.cpp
    comm/TaskManager.cpp
    comm/Tool.cpp
    comm/UDPWriter.cpp
    comm/Writer.cpp
    comm/AgentManager.cpp
    comm/Epoll.cpp
    comm/Reader.cpp
    comm/TCPAgent.cpp
    comm/UDPAgent.cpp
    comm/UnxDmnAgent.cpp
    comm/BufferManager.cpp
    comm/EpollEvent.cpp
    comm/SocketAddress.cpp
    comm/TCPSocket.cpp
    comm/UDPSocket.cpp
    comm/UnxDmnSocket.cpp
)

# daemon
set(DAEMON_SRC
    daemon/Daemon.cpp
)

# log
set(LOG_SRC
    log/Appender.cpp
    log/ConsoleAppender.cpp
    log/Logger.cpp
    log/LoggerFactory.cpp
    log/SyslogAppender.cpp
)

# odbc
set(ODBC_SRC
    odbc/ConnectionFactory.cpp
    odbc/ConnectionPool.cpp  
    odbc/ODBCBindColumnException.cpp     
    odbc/odbcerr.cpp        
    odbc/Statement.cpp
    odbc/ConnectionImpl.cpp
    odbc/ODBCBindParameterException.cpp
    odbc/ODBCException.cpp
)

# sys
set(SYS_SRC
    sys/BaseThreadPool.cpp  
    sys/Cond.cpp  
    sys/Exception.cpp  
    sys/Mutex.cpp  
    sys/Thread.cpp  
    sys/ThreadPool.cpp  
    sys/ThreadPoolDispatcher.cpp  
    sys/Time.cpp
)

# Timer
set(TIMER_SRC
    Timer/Timer.cpp
)

# util
set(UTILS_SRC
    util/io.cpp
)

# xml
set(XML_SRC
    xml/XMLConfig.cpp
)

set(HTTP_SRC
    http/HttpAgent.cc
    http/HttpRequest.cc
    http/HttpResponse.cc
)

set(LIB_NDSL_SRC
    ${COMM_SRC}
    ${DAEMON_SRC}
    ${LOG_SRC}
    ${ODBC_SRC}
    ${SYS_SRC}
    ${TIMER_SRC}
    ${UTILS_SRC}
    ${XML_SRC}
    ${HTTP_SRC}
)

add_library(ndsl ${LIB_NDSL_SRC})
target_link_libraries(ndsl pthread)